package com.chen.Dome1test;

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String[] a=new String[n];
        for(int i=0;i<n;i++) {
            a[i]=sc.next();
        }
        String x=sc.next();
        for(int i=0;i<n;i++) {
            if(a[i].equals(x)){
                System.out.println(i);
                return;
            }
        }
        System.out.println(-1);

    }
}